<template>
<div>
		<div class="common-form">
			<span>{{curItem.name}}</span>
		</div>
		<el-form size="small" :model="curItem" label-width="100px">
			<div class="f16 gray3 form-subtitle">{{$t('page.margin_setting')}}</div>
			<div class="form-item">
				<div class="form-label">{{$t('page.footer_bg_label')}}</div>
				<div class="flex-1 d-s-c" style="height: 36px;">
					<el-color-picker size="default" v-model="curItem.style.background"></el-color-picker>
					<el-input class="ml10" v-model="curItem.style.background" />
					<el-button style="margin-left: 10px;" @click.stop="$parent.onEditorResetColor(curItem.style, 'background', '#ffffff')" type="primary" link>{{$t('page.reset')}}</el-button>
				</div>
			</div>
			<div class="form-item">
				<div class="form-label">{{$t('page.component_bg_label')}}</div>
				<div class="flex-1 d-s-c" style="height: 36px;">
					<el-color-picker size="default" v-model="curItem.style.bgcolor"></el-color-picker>
					<el-input class="ml10" v-model="curItem.style.bgcolor" />
					<el-button style="margin-left: 10px;" @click.stop="$parent.onEditorResetColor(curItem.style, 'bgcolor', '#F2F2F2')" type="primary" link>{{$t('page.reset')}}</el-button>
				</div>
			</div>
			<!--上下边距-->
			<div class="form-item">
				<div class="form-label">{{$t('page.margin_top_label')}}</div>
				<el-slider v-model="curItem.style.paddingTop" size="small" show-input :show-input-controls="false" input-size="small"></el-slider>
			</div>
			<!--上下边距-->
			<div class="form-item">
				<div class="form-label">{{$t('page.margin_bottom_label')}}</div>
				<el-slider v-model="curItem.style.paddingBottom" size="small" show-input :show-input-controls="false" input-size="small"></el-slider>
			</div>
			<!--左右边距-->
			<div class="form-item">
				<div class="form-label">{{$t('page.margin_lr_label')}}</div>
				<el-slider v-model="curItem.style.paddingLeft" size="small" show-input :show-input-controls="false" input-size="small"></el-slider>
			</div>
			<!--左右边距-->
			<div class="form-item">
				<div class="form-label">{{$t('page.border_radius_top_label')}}</div>
				<el-slider v-model="curItem.style.topRadio" size="small" show-input :show-input-controls="false" input-size="small"></el-slider>
			</div>
			<!--左右边距-->
			<div class="form-item">
				<div class="form-label">{{$t('page.border_radius_bottom_label')}}</div>
				<el-slider v-model="curItem.style.bottomRadio" size="small" show-input :show-input-controls="false" input-size="small"></el-slider>
			</div>
			<div class="form-chink"></div>
			<div class="f16 gray3 form-subtitle" style="margin-bottom: 10px;">{{$t('page.article_setting')}}</div>
			<!-- 文章分类 -->
			<el-form-item :label="$t('page.article_category_label')">
				<el-select v-model="curItem.params.auto.category">
					<el-option :label="$t('page.all_categories')" :value="0"></el-option>
					<el-option v-for="item in category" :key="item.categoryId" :label="item.name" :value="item.categoryId"></el-option>
				</el-select>
			</el-form-item>
			<!-- 显示数量 -->
			<el-form-item :label="$t('page.display_count_label')">
				<el-input type="number" style="width: auto;" v-model="curItem.params.auto.showNum" class="w-auto"></el-input>
				<div class="ww100" style="cursor: pointer;"> {{$t('page.article_data_note_1')}} 

<span style="color: var(--el-color-primary)" @click="gotoArticle">{{$t('page.article_data_note_3')}}</span> {{$t('page.article_data_note_2')}} 

</div>
			</el-form-item>
			<!--显示类型-->
			<el-form-item :label="$t('page.display_type_label')">
				<el-radio-group v-model="curItem.style.display">
					<el-radio :label="10">{{$t('page.with_image')}}</el-radio>
					<el-radio :label="20">{{$t('page.without_image')}}</el-radio>
				</el-radio-group>
			</el-form-item>
		</el-form>
	</div>
</template>

<script>
import ArticleApi from '@/api/article.js';
export default {
  data() {
    return {
      category: {}
    };
  },
  props: ['curItem', 'selectedIndex', 'opts'],
  created() {
    this.curItem.style.display = parseInt(this.curItem.style.display);
    /*获取文章栏目*/
    this.getData();
  },
  methods: {
    /*获取文章栏目*/
    getData() {
      let self = this;
      ArticleApi.getCategory({}, true).then(res => {
        self.category = res.data;
      }).catch(error => {
        self.loading = false;
      });
    },
    gotoArticle() {
      this.$router.push("/plus/article/index");
    }
  }
};
</script>

